package com.hwz.gulimaill.thridParty.controller;

import com.hwz.common.utils.R;
import com.hwz.gulimaill.thridParty.service.SmsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.mail.MessagingException;

/**
 * @Author: hwz
 * @CreateTime: 2025-10-19
 */

@RestController("/sms")
@Slf4j
public class SmsController {

    @Resource
    SmsService smsService;

    @GetMapping("/sendCode")
    public R sendCode(String phone, String code) {
        try {
            smsService.sendCode(phone, code);
            return R.ok();
        } catch (Exception e) {
            log.error("发送邮件异常"+e.getMessage());
            return R.error(500,"发送邮件异常");
        }
    }
}
